package main

func main() {
	ch := make(chan int)

	go func() {
		for i := 0; i < 5; i++ {
			ch <- i
		}
		close(ch) //管道关闭后,管道中的值为0.
	}()

	for {
		j := <-ch
		println(j)
	}

}
